﻿<?xml version="1.0" encoding="utf-8" ?>
<rules xmlns="http://transcriber.codeplex.com/Rules.xsd"
      title="Mode of Beleriand"
       author="Kirk"
       caseSensitive="false"
       copyright="Open source distributed without warranty of any kind"
       unmatchedAction="EmitReplacement"
       replacementText="¤">

  <!-- PUT INPUT INTO CANONICAL FORM BEFORE TRANSCRIPTION -->

  <!-- replace c with k -->
  <rule pattern="c">
    <intermediate>k</intermediate>
  </rule>
  
  <!-- replace q with kw -->
  <rule pattern="qu{0,1}">
    <intermediate>kw</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[äâà]">
    <intermediate>a</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[ëêè]">
    <intermediate>e</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[ïîì]">
    <intermediate>i</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[öôò]">
    <intermediate>o</intermediate>
  </rule>

  <!-- remove cosmetic diacriticals -->
  <rule pattern="[üûù]">
    <intermediate>u</intermediate>
  </rule>

  <!-- replace æ with separate a and e -->
  <rule pattern="æ">
    <intermediate>ae</intermediate>
  </rule>

  <!-- NUMBERS -->

  <import filename="TengwarNumerals.xml"/>

  <!-- DIPHTHONGS -->

  <!--<rule pattern="ai">
    <final>]Õ</final>
  </rule>

  <rule pattern="ui">
    <final>.Õ</final>
  </rule>

  <rule pattern="ei">
    <final>lÕ</final>
  </rule>

  <rule pattern="ae">
    <final>]Ý</final>
  </rule>

  <rule pattern="oe">
    <final>hÝ</final>
  </rule>

  <rule pattern="a[uw]">
    <final>]é</final>
  </rule>-->
  
  <!-- COMPOUND CONSONANTS-->

  <rule pattern="dw">
    <final>2è</final>
  </rule>

  <rule pattern="nw">
    <final>5è</final>
  </rule>

  <rule pattern="gw">
    <final>xè</final>
  </rule>

  <rule pattern="lw">
    <final>jé</final>
  </rule>

  <rule pattern="nt">
    <final>1p</final>
  </rule>

  <rule pattern="mb">
    <final>wP</final>
  </rule>

  <rule pattern="mh($|\s+)">
    <final>t£</final>
  </rule>

  <rule pattern="mh">
    <final>t+</final>
  </rule>

  <rule pattern="ll">
    <final>j°</final>
  </rule>

  <rule pattern="kw">
    <final>z</final>
  </rule>

  <rule pattern="th">
    <final>3</final>
  </rule>

  <rule pattern="kh">
    <final>d</final>
  </rule>

  <rule pattern="dh">
    <final>4</final>
  </rule>

  <rule pattern="gh">
    <final>f</final>
  </rule>

  <rule pattern="nn">
    <final>5</final>
  </rule>

  <rule pattern="mm">
    <final>t</final>
  </rule>

  <rule pattern="ng">
    <final>g</final>
  </rule>

  <rule pattern="rh">
    <final>u</final>
  </rule>

  <rule pattern="lh">
    <final>m</final>
  </rule>

  <rule pattern="ss">
    <final>k</final>
  </rule>
  
  <!-- SINGLE CONSONANTS -->

  <rule pattern="t">
    <final>1</final>
  </rule>

  <rule pattern="p">
    <final>q</final>
  </rule>

  <rule pattern="k">
    <final>a</final>
  </rule>

  <rule pattern="d">
    <final>2</final>
  </rule>

  <rule pattern ="b">
    <final>w</final>
  </rule>

  <rule pattern="g">
    <final>s</final>
  </rule>

  <rule pattern="f">
    <final>e</final>
  </rule>

  <rule pattern="v">
    <final>r</final>
  </rule>

  <rule pattern="n">
    <final>6</final>
  </rule>

  <rule pattern="m">
    <final>y</final>
  </rule>

  <rule pattern="w">
    <final>n</final>
  </rule>

  <rule pattern="r">
    <final>7</final>
  </rule>

  <rule pattern="l">
    <final>j</final>
  </rule>

  <rule pattern="s">
    <final>8</final>
  </rule>

  <rule pattern="h">
    <final>9</final>
  </rule>
  
  <!-- VOWELS -->

  <rule pattern="a">
    <final>]</final>
  </rule>

  <rule pattern="e">
    <final>l</final>
  </rule>

  <rule pattern="i">
    <final>`</final>
  </rule>

  <rule pattern="o">
    <final>h</final>
  </rule>

  <rule pattern="u">
    <final>.</final>
  </rule>

  <rule pattern="á">
    <final>]R</final>
  </rule>

  <rule pattern="é">
    <final>lR</final>
  </rule>

  <rule pattern="í">
    <final>`V</final>
  </rule>

  <rule pattern="ó">
    <final>hR</final>
  </rule>

  <rule pattern="ú">
    <final>.R</final>
  </rule>

  <!-- WHITESPACE / PUNCTUATION -->

  <rule pattern="(\s+)">
    <final>$1</final>
  </rule>

  <rule pattern="!">
    <final>Á</final>
  </rule>

  <rule pattern="\?">
    <final>À</final>
  </rule>

  <rule pattern="\p{Ps}|\p{Pe}">
    <final>›</final>
  </rule>

  <rule pattern="\p{Pd}">
    <final>Â</final>
  </rule>

  <rule pattern=",">
    <final>ˆ</final>
  </rule>

  <rule pattern="\.">
    <final>=</final>
  </rule>

</rules>